﻿<UserControl x:Class="personalplaner.gui.common.views.InitWizardTeamView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:p="clr-namespace:personalplaner.gui.Properties"
             xmlns:c="clr-namespace:personalplaner.common.controls;assembly=personalplaner.common"
             xmlns:bs="clr-namespace:personalplaner.business.stamm;assembly=personalplaner.business"
             mc:Ignorable="d" >
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition/>
        </Grid.RowDefinitions>

        <TextBlock Text="{x:Static p:Resources.Team}" FontSize="22" FontWeight="Thin" Foreground="#E1000000" Margin="50,-5,0,15"/>

        <Grid Grid.Row="1">
            <Grid.Resources>
                <DataTemplate DataType="{x:Type bs:Abteilung}">
                    <Grid Margin="0,0,20,0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <TextBlock Text="{Binding Name}" Grid.Column="1"/>
                    </Grid>
                </DataTemplate>
            </Grid.Resources>

            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>

            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="180"/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>

            <ListBox ItemsSource="{Binding Abteilungen}" SelectedItem="{Binding ActiveGridItem}" Margin="10,10,0,0"/>

            <GroupBox Margin="5,5,5,0" Grid.Column="1">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="70"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="130"/>
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>

                    <TextBlock VerticalAlignment="Center" Text="Name"/>
                    <TextBox Grid.Column="1" Margin="2"
                         IsEnabled="{Binding DataContext.IsEditEnabled, ElementName=baseControl}"
                         DataContext="{Binding SelectedAbteilung}" 
                         Text="{FocusBinding Path=Name, UpdateSourceTrigger=PropertyChanged}"/> <!--Text="{FocusBinding Path=Name, ValidatesOnDataErrors=True}"-->

                    <TextBlock VerticalAlignment="Top" Grid.Row="1" Text="Beschreibung" />
                    <TextBox Grid.Column="1" Grid.Row="1" AcceptsReturn="True" TextWrapping="Wrap" Margin="2" 
                         IsEnabled="{Binding DataContext.IsEditEnabled, ElementName=baseControl}"
                         DataContext="{Binding SelectedAbteilung}" 
                         Text="{FocusBinding Path=Beschreibung}"/> <!--Text="{FocusBinding Path=Beschreibung, ValidatesOnDataErrors=True}"-->

                    <TextBlock VerticalAlignment="Center" Grid.Row="2" Text="Stunden pro Tag" />
                    <c:NumericTextBox Grid.Column="1" Grid.Row="2" Margin="2" Width="100" HorizontalAlignment="Left"
                         IsEnabled="{Binding DataContext.IsEditEnabled, ElementName=baseControl}"
                         DataContext="{Binding SelectedAbteilung}" 
                         Text="{FocusBinding Path=EinsaetzeProTag, UpdateSourceTrigger=PropertyChanged}"/>
                    
                    <TextBlock Text="{x:Static p:Resources.TeamStundenProTagBeschreibung}" Grid.Row="3" Grid.Column="1" TextWrapping="Wrap" Margin="0,10,0,0"/>
                    
                </Grid>
            </GroupBox>

            <StackPanel Grid.Row="1" Grid.ColumnSpan="2" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,20,40,20">
                <Button MinWidth="60" Margin="5" 
                    Command="{Binding DeleteCommand}">
                    <TextBlock Text="{x:Static p:Resources.Delete}"/>
                </Button>
                <Button MinWidth="60" Margin="5" Command="{Binding NewCommand}">
                    <TextBlock Text="{x:Static p:Resources.New}"/>
                </Button>
                <Button MinWidth="60" Margin="5" Command="{Binding SaveCommand}">
                    <TextBlock Text="{x:Static p:Resources.Add}"/>
                </Button>
            </StackPanel>
        </Grid>
        
    </Grid>
</UserControl>
